package com.ponhu.ea2.enums;

/**
 * 货品类别
 * @author zhaokai
 */
public enum InventoryCategoryEnum{

    SECONDHAND(1, "二奢"),
    NEWS(2, "标品"),
    ;

    private Integer code;

    private String name;

    InventoryCategoryEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     * 根据Code枚举值
     * @param code
     * @return
     */
    public static String getNameByCode(Integer code){
        for (InventoryCategoryEnum value : InventoryCategoryEnum.values()) {
            if(value.getCode().equals(code)){
                return value.getName();
            }
        }
        return null;
    }
}
